﻿// =================================================================== 
// 项目说明
//====================================================================
// SunCity@Copy Right 2006-2008
// 文件： UserInfo.cs
// 项目名称：SunCity_MS 
// 创建时间：2015/3/18
// 负责人：Chris
// ===================================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using EMS20.Entity;
using EMS20.IDataAccessLayer;

namespace EMS20.DataAccessLayer
{
    /// <summary>
    /// 数据层实例化接口类  dbo.UserInfo.
    /// </summary>
    public partial class UserInfoDataAccessLayer : IUserInfoDataAccessLayer
    {
        /// <summary>
        /// 通过用户名和密码得到实体对象
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        public UserInfoEntity GetEntityByPasswordAndName(string name, string pwd)
        {
            UserInfoEntity _obj = null;
            SqlParameter[] _param ={
			new SqlParameter("@u_name",SqlDbType.NVarChar,255),
			new SqlParameter("@u_pwd",SqlDbType.NVarChar,255)
			};
            _param[0].Value = name;
            _param[1].Value = pwd;
            string sqlStr = "select * from UserInfo where u_name=@u_name and u_pwd=@u_pwd";
            using (SqlDataReader dr = SqlHelper.ExecuteReader(Conn.SqlConn, CommandType.Text, sqlStr, _param))
            {
                while (dr.Read())
                {
                    _obj = Populate_UserInfoEntity_FromDr(dr);
                }
            }
            return _obj;




        }
    }
}
